import './public/common.css'

import { createApp } from 'vue'

import App from './App.vue'
import router from './router'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import pinia from './stores'

// 引入 Font Awesome
import { library } from '@fortawesome/fontawesome-svg-core'
import { faHeart as fasHeart, faStar as fasStar } from '@fortawesome/free-solid-svg-icons'
import { faHeart as farHeart, faStar as farStar } from '@fortawesome/free-regular-svg-icons'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'

// Vuetify
import 'vuetify/styles'
import { createVuetify } from 'vuetify'
import * as components from 'vuetify/components'
import * as directives from 'vuetify/directives'

// 添加图标到库中
library.add(fasHeart, farHeart)
library.add(fasStar, farStar)

const vuetify = createVuetify({
  components,
  directives,
})

const app = createApp(App)

app.use(pinia).use(router).use(vuetify)

app.component('font-awesome-icon', FontAwesomeIcon)

app.mount('#app')

for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}
